package com.zhz.controller;

import com.zhz.model.LoginResult;
import com.zhz.service.SysLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：zhz
 * @date ：Created in 2020/12/20
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 * @description: 登录的控制器
 **/
@RestController
@Api(tags = "登录的控制器")
public class SysLoginController {

    @Autowired
    private SysLoginService sysLoginService;

    @PostMapping("/login")
    @ApiOperation(value = "后台管理人员登录")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name="username",value = "用户名称"),
                    @ApiImplicitParam(name="password",value = "用户密码")
            }
    )
    public LoginResult login(
            @RequestParam(required = true) String username,     // 用户名称
            @RequestParam(required = true) String password){    // 用户的密码
        return sysLoginService.login(username,password);
    }
}
